﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bai07
{
    public interface ISoSanh
    {
        bool SoSanh(object a);
    }
    public class SoNguyen : ISoSanh
    {
        int data;
        public int Data
        {
            get { return data; }
            set { data = value; }
        }
        public SoNguyen(int d)
        {
            data = d;
        }
        public bool SoSanh(object a)
        {
            SoNguyen sv = (SoNguyen)a;
            if (sv.Data > data)
                return true;
            else
                return false;
        }
    }

    class Sapxep
    {
        public static void SapXepTang(object[] a, int n)
        {
            for (int i = 0; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    ISoSanh x = (ISoSanh)a[i];
                    ISoSanh y = (ISoSanh)a[j];
                    if (x.SoSanh(y) == true)
                    {
                        object t = a[i]; a[i] = a[j]; a[j] = t;
                    }
                }
            }
        }

    }

}

